
#include <QDebug>
#include <QFileInfo>
#include <QIcon>

#include "plugin-config.h"
#include "plugin.h"
#include "isomode.h"

#include "utils.h"

extern "C" {
    AbstractPlugin* PluginInstance()
    {
        AbstractPlugin *plugin = new Plugin();
        return plugin;
    }
    AbstractPlugin* createPlugin()
    {
        AbstractPlugin *plugin = new Plugin();
        return plugin;
    }
}

Plugin::Plugin(QObject *parent) : AbstractPlugin{parent}
{
    MiscUtils::LoadLanguage(QLatin1String(PLUGIN_INTERNAL_NAME));
}

// Base
int Plugin::order()
{
    return 0;
}

QString Plugin::pluginInternalName()
{
    return QLatin1String(PLUGIN_INTERNAL_NAME);
}

QString Plugin::pluginName()
{
    return PLUGIN_NAME;
}

QString Plugin::pluginVersion()
{
    return QLatin1String(PLUGIN_VERSION);
}

QString Plugin::pluginSummary()
{
    return PLUGIN_SUMMARY;
}

QString Plugin::pluginDescription()
{
    return PLUGIN_DESCRIPTION;
}

QIcon Plugin::pluginIcon()
{
    QIcon icon;
    QString iconfile(PLUGIN_ICON_FILE);
    if (!iconfile.isEmpty() && QFileInfo::exists(iconfile)) {
        icon.addFile(iconfile);
    }
    return icon;
}

QWidget *Plugin::createWidget()
{
    ISOMode *plugin = new ISOMode();
    return plugin;
}
